package router

import (
	"github.com/gin-gonic/gin"
	"saleforce/sf-backend-gateway/controller"
	"saleforce/sf-backend-gateway/middleware"
)

func loadRouterGroups(group *gin.RouterGroup) {
	group.GET("/ping", func(c *gin.Context) {
		c.JSON(200, gin.H{"message": "pong"})
	})
	group.POST("/backend/b/login", controller.LoginController{}.Login).Use(middleware.Cross()) //后端登录接口
	afterLogin := group.Group("/backend/l/").Use(middleware.Cross()).Use(middleware.Auth()).Use(middleware.Check())
	{
		afterLogin.POST("/user/menu/list", controller.BkMenuController{}.MenuList)
		afterLogin.POST("/user/menu/detail", controller.BkMenuController{}.Detail)
	}
	group.POST("/logout", controller.LoginController{}.Logout)
}
